<template>
  <div class="home-container">
    <!-- 主要内容区 -->
    <div class="main-content">
      <!-- 驾校简介 -->
      <el-card class="intro-card">
        <div slot="header" class="card-header">
          <span>驾校简介</span>
        </div>
        <div class="intro-content">
          <div class="intro-image">
            <img
              src="@/assets/driving-school-main.jpg"
              alt="驾校风采"
              class="responsive-img"
              @error="setImagePlaceholder">
          </div>
          <div class="intro-text">
            <p class="intro-paragraph">
              欢迎来到龙王驾校在线学习平台！我们致力于为学员提供最优质的驾驶培训服务，
              拥有专业的教练团队和先进的教学设备。自成立以来，我们已帮助 thousands of 学员
              成功拿到驾照，是本地最受欢迎的驾校之一。
            </p>
            <p class="intro-paragraph">
              我们的教练团队均由经验丰富的资深驾驶员组成，持有国家认证的教练资格证书，
              熟悉最新的交通法规和考试标准。无论您是初次学车还是需要补考，我们都能为您提供
              个性化的教学方案。
            </p>
          </div>

          <div class="features">
            <el-row :gutter="30">
              <el-col :span="12">
                <div class="feature-item">
                  <div class="feature-icon-wrapper">
                    <i class="el-icon-user-solid feature-icon"></i>
                  </div>
                  <div class="feature-text">
                    <div class="feature-title">专业教练</div>
                    <div class="feature-desc">持证上岗，经验丰富</div>
                  </div>
                </div>
              </el-col>
              <el-col :span="12">
                <div class="feature-item">
                  <div class="feature-icon-wrapper">
                    <i class="el-icon-timer feature-icon"></i>
                  </div>
                  <div class="feature-text">
                    <div class="feature-title">灵活安排</div>
                    <div class="feature-desc">随时预约，自由学习</div>
                  </div>
                </div>
              </el-col>
              <el-col :span="12">
                <div class="feature-item">
                  <div class="feature-icon-wrapper">
                    <i class="el-icon-medal feature-icon"></i>
                  </div>
                  <div class="feature-text">
                    <div class="feature-title">高通过率</div>
                    <div class="feature-desc">通过率高达95%以上</div>
                  </div>
                </div>
              </el-col>
              <el-col :span="12">
                <div class="feature-item">
                  <div class="feature-icon-wrapper">
                    <i class="el-icon-service feature-icon"></i>
                  </div>
                  <div class="feature-text">
                    <div class="feature-title">贴心服务</div>
                    <div class="feature-desc">一对一辅导，答疑解惑</div>
                  </div>
                </div>
              </el-col>
            </el-row>
          </div>

          <div class="gallery-section">
            <h3 class="section-title">校园环境</h3>
            <div class="gallery-images">
              <div class="gallery-item">
                <img
                  src="@/assets/training-ground.jpg"
                  alt="训练场"
                  class="gallery-img"
                  @error="setImagePlaceholder">
                <div class="gallery-caption">现代化训练场</div>
              </div>
              <div class="gallery-item">
                <img
                  src="@/assets/coach-car.jpg"
                  alt="教练车"
                  class="gallery-img"
                  @error="setImagePlaceholder">
                <div class="gallery-caption">全新教练车</div>
              </div>
            </div>
          </div>

          <div class="mission-section">
            <h3 class="section-title">我们的使命</h3>
            <p class="mission-text">
              我们以培养安全、文明、合格的驾驶员为己任，秉承"学员至上，服务第一"的宗旨，
              不断创新教学方法，提升服务质量，努力打造本地最专业的驾驶培训品牌。
            </p>
            <div class="quote-section">
              <div class="quote-mark">"</div>
              <p class="quote-text">
                安全驾驶，从我们这里开始
              </p>
            </div>
          </div>
        </div>
      </el-card>
    </div>
  </div>
</template>

<script>
export default {
  name: 'HomePage',
  methods: {
    setImagePlaceholder(event) {
      // 当图片加载失败时，设置为占位图
      event.target.src = '';
    }
  }
}
</script>

<style scoped>
.home-container {
  font-family: 'Microsoft YaHei', sans-serif;
  background: linear-gradient(135deg, #f5f7fa 0%, #e4edf9 100%);
  min-height: 100vh;
  padding: 30px 0;
}

.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.card-header {
  font-weight: bold;
  font-size: 24px;
  color: #2c3e50;
  text-align: center;
  padding: 15px 0;
}

.intro-card {
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  border: none;
  overflow: hidden;
}

.intro-content {
  padding: 20px;
}

.intro-image {
  text-align: center;
  margin-bottom: 30px;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.responsive-img {
  width: 100%;
  height: 350px;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.responsive-img:hover {
  transform: scale(1.02);
}

.intro-text {
  margin-bottom: 30px;
}

.intro-paragraph {
  font-size: 16px;
  line-height: 1.8;
  color: #555;
  margin-bottom: 20px;
  text-align: justify;
}

.features {
  margin-bottom: 40px;
}

.feature-item {
  display: flex;
  align-items: flex-start;
  margin-bottom: 25px;
  padding: 15px;
  background: #f8fafc;
  border-radius: 10px;
  transition: all 0.3s ease;
}

.feature-item:hover {
  background: #eef5ff;
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

.feature-icon-wrapper {
  background: linear-gradient(135deg, #409EFF 0%, #1a73e8 100%);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 15px;
  flex-shrink: 0;
}

.feature-icon {
  font-size: 24px;
  color: white;
}

.feature-text {
  flex: 1;
}

.feature-title {
  font-weight: bold;
  font-size: 18px;
  margin-bottom: 5px;
  color: #2c3e50;
}

.feature-desc {
  font-size: 14px;
  color: #7f8c8d;
}

.gallery-section {
  margin-bottom: 40px;
}

.section-title {
  font-size: 22px;
  color: #2c3e50;
  text-align: center;
  margin-bottom: 25px;
  position: relative;
  padding-bottom: 10px;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background: linear-gradient(to right, #409EFF, #1a73e8);
  border-radius: 3px;
}

.gallery-images {
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
}

.gallery-item {
  flex: 1;
  min-width: 250px;
  max-width: 350px;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}

.gallery-item:hover {
  transform: translateY(-10px);
}

.gallery-img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.gallery-caption {
  background: #f8fafc;
  padding: 12px;
  text-align: center;
  font-weight: 500;
  color: #2c3e50;
}

.mission-section {
  background: linear-gradient(135deg, #eef7ff 0%, #e4f0ff 100%);
  padding: 30px;
  border-radius: 12px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}

.mission-section::before {
  content: '';
  position: absolute;
  top: -20px;
  right: -20px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(64, 158, 255, 0.1);
}

.mission-section::after {
  content: '';
  position: absolute;
  bottom: -30px;
  left: -30px;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: rgba(26, 115, 232, 0.1);
}

.mission-text {
  font-size: 16px;
  line-height: 1.8;
  color: #555;
  margin-bottom: 30px;
  position: relative;
  z-index: 1;
}

.quote-section {
  text-align: center;
  position: relative;
  z-index: 1;
}

.quote-mark {
  font-size: 80px;
  color: rgba(64, 158, 255, 0.2);
  font-family: Georgia, serif;
  line-height: 1;
}

.quote-text {
  font-size: 22px;
  font-weight: bold;
  color: #2c3e50;
  font-style: italic;
  margin-top: -40px;
}

@media (max-width: 768px) {
  .home-container {
    padding: 15px 0;
  }

  .main-content {
    padding: 0 15px;
  }

  .responsive-img {
    height: 200px;
  }

  .feature-item {
    flex-direction: column;
    text-align: center;
  }

  .feature-icon-wrapper {
    margin-right: 0;
    margin-bottom: 10px;
  }

  .gallery-images {
    flex-direction: column;
    align-items: center;
  }

  .gallery-item {
    width: 100%;
    max-width: 100%;
  }

  .mission-section {
    padding: 20px;
  }

  .quote-text {
    font-size: 18px;
  }
}
</style>